package com.draem0507.refactor;

/**
 * @title 条件判断代替异常
 * @desc
 * @atuh lwx
 * @createtime on 2015/11/14 13:48
 */
public class Day_18 {




    public class Microwave1
    {


        public boolean Start()
        {
            boolean foodCooked = false;
               //mock 模拟先判断是否满足某种条件，避免异常发生
                if(true){
                    //do something
                    foodCooked = true;
                }else {

                    foodCooked = false;
                }

            return foodCooked;
        }
    }



    public class Microwave
    {


        public boolean Start()
        {
            boolean foodCooked = false;
            try
            {
                //do something perhaps throw new exception
                foodCooked = true;
            }
            catch (Exception e)
            {
                foodCooked = false;
            }

            return foodCooked;
        }
    }
}
